module Encoder8x3a(
  input En,
  input  [7:0] I,
  output [2:0] Y
  // reg GS
  ); 
  reg [2:0]  Out_coding; 
  assign Y = Out_coding;
  
  always @(I)
  begin
  //if(~En)
   // begin
    //   Out_coding=3'd0; GS = 1'b0; 
   // end
  //else begin
    //GS=1'b1;
    casez(I) 
      8'b1???_????:Out_coding = 3'd7;
      8'b01??_????:Out_coding = 3'd6;
      8'b001?_????:Out_coding = 3'd5;
      8'b0001_????:Out_coding = 3'd4;
      8'b0000_1???:Out_coding = 3'd3;
      8'b0000_01??:Out_coding = 3'd2;
      8'b0000_001?:Out_coding = 3'd1;
      8'b0000_0001:Out_coding = 3'd0;
      8'b0000_0000:begin Out_coding = 3'd0; end
      default: begin Out_coding=3'd0; end
    endcase
    //end
  end
endmodule

